SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:%.c=%.o)
LIBS = $(OBJECTS:%.o=%.so)

CC = gcc
CC_FLAGS = -fPIC -Wall -pedantic -o0 -g
LD_FLAGS = -shared -rdynamic

all: $(LIBS)

%.so: %.o
	$(CC) $< -o $@ $(LD_FLAGS)

%.o: %.c
	$(CC) -c $(CC_FLAGS) $< -o $@

clean:
	rm -rf $(OBJECTS) $(LIBS)
